#include <iostream>
#include <sstream>
#include <mono/parser/property_node.h>
#include <mono/parser/property_tree_printer.h>
#include <mono/parser/property_tree_parser.h>
#include <mono/common/cmdline.h>
#include <mono/common/file.h>

int main(int argc, char**argv)
{
	mono::CmdParser p;
	p.add<std::string>("config", 'c', "config file path", true, "");
	p.parse_check(argc, argv);

	std::string path = p.get<std::string>("config");
	mono::File file(path);
	if(!file.exists()) {
		std::cout<<"[error] file not exists"<<std::endl;
	}
	std::string content;
	bool ret = file.readToString(content);
	if(!ret) {
		std::cout<<"[error] read file content error"<<std::endl;
	}
	mono::PropertyTreeParser parser;
	mono::PropertyNodePtr createdTree = parser.parse(content);
	mono::PropertyTreePrinter printer(std::cout);
	printer.print(createdTree);
	return 0;

}